home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / message / subcls / clipview.bas < prev    next >
Encoding:
BASIC Source File  |  1995-05-31  |  3.6 KB  |  93 lines

  1. Option Explicit
  2.  
  3. ' Required data structures
  4. Type RECT
  5.    left As Integer
  6.    top As Integer
  7.    right As Integer
  8.    bottom As Integer
  9. End Type
  10.  
  11. Type PAINTSTRUCT
  12.    hdc As Integer
  13.    fErase As Integer
  14.    rcPaint As RECT
  15.    fRestore As Integer
  16.    fIncUpdate As Integer
  17.    rgbReserved As String * 16
  18. End Type
  19.  
  20. ' Clipboard Manager Functions
  21. Declare Function OpenClipboard Lib "User" (ByVal hWnd As Integer) As Integer
  22. Declare Function CloseClipboard Lib "User" () As Integer
  23. Declare Function GetClipboardOwner Lib "User" () As Integer
  24. Declare Function SetClipboardViewer Lib "User" (ByVal hWnd As Integer) As Integer
  25. Declare Function GetClipboardViewer Lib "User" () As Integer
  26. Declare Function ChangeClipboardChain Lib "User" (ByVal hWnd As Integer, ByVal hWndNext As Integer) As Integer
  27. Declare Function SetClipboardData Lib "User" (ByVal wFormat As Integer, ByVal hMem As Integer) As Integer
  28. Declare Function GetClipboardData Lib "User" (ByVal wFormat As Integer) As Integer
  29. Declare Function RegisterClipboardFormat Lib "User" (ByVal lpString As String) As Integer
  30. Declare Function CountClipboardFormats Lib "User" () As Integer
  31. Declare Function EnumClipboardFormats Lib "User" (ByVal wFormat As Integer) As Integer
  32. Declare Function GetClipboardFormatName Lib "User" (ByVal wFormat As Integer, ByVal lpString As String, ByVal nMaxCount As Integer) As Integer
  33. Declare Function EmptyClipboard Lib "User" () As Integer
  34. Declare Function IsClipboardFormatAvailable Lib "User" (ByVal wFormat As Integer) As Integer
  35. Declare Function GetPriorityClipboardFormat Lib "User" (lpPriorityList As Integer, ByVal nCount As Integer) As Integer
  36.  
  37. ' Other required Win16 APIs
  38. Declare Function SendMessage Lib "User" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Any) As Long
  39. Declare Function GlobalLock Lib "Kernel" (ByVal hMem As Integer) As Long
  40. Declare Function GlobalUnlock Lib "Kernel" (ByVal hMem As Integer) As Integer
  41. Declare Function GlobalAlloc Lib "Kernel" (ByVal wFlags As Integer, ByVal dwBytes As Long) As Integer
  42. Declare Function GlobalFree Lib "Kernel" (ByVal hMem As Integer) As Integer
  43. Declare Sub HMemCpy Lib "kernel" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
  44. Declare Sub GetClientRect Lib "User" (ByVal hWnd As Integer, lpRect As RECT)
  45.  
  46. ' Clipboard Window Messages
  47. Global Const WM_RENDERFORMAT = &H305
  48. Global Const WM_RENDERALLFORMATS = &H306
  49. Global Const WM_DESTROYCLIPBOARD = &H307
  50. Global Const WM_DRAWCLIPBOARD = &H308
  51. Global Const WM_PAINTCLIPBOARD = &H309
  52. Global Const WM_VSCROLLCLIPBOARD = &H30A
  53. Global Const WM_SIZECLIPBOARD = &H30B
  54. Global Const WM_ASKCBFORMATNAME = &H30C
  55. Global Const WM_CHANGECBCHAIN = &H30D
  56. Global Const WM_HSCROLLCLIPBOARD = &H30E
  57.  
  58. ' Predefined Clipboard Formats
  59. Global Const CF_TEXT = 1
  60. Global Const CF_BITMAP = 2
  61. Global Const CF_METAFILEPICT = 3
  62. Global Const CF_SYLK = 4
  63. Global Const CF_DIF = 5
  64. Global Const CF_TIFF = 6
  65. Global Const CF_OEMTEXT = 7
  66. Global Const CF_DIB = 8
  67. Global Const CF_PALETTE = 9
  68. Global Const CF_OWNERDISPLAY = &H80
  69. Global Const CF_DSPTEXT = &H81
  70. Global Const CF_DSPBITMAP = &H82
  71. Global Const CF_DSPMETAFILEPICT = &H83
  72.  
  73. ' Global memory flags
  74. Global Const GMEM_FIXED = &H0
  75. Global Const GMEM_ZEROINIT = &H40
  76.  
  77. Function MakeLong (WordHi As Variant, WordLo%) As Long
  78.   MakeLong = (WordHi * &H10000) + (WordLo And &HFFFF&)
  79. End Function
  80.  
  81. Function WordHi (LongIn&) As Integer
  82.    WordHi = (LongIn And &HFFFF0000) \ &H10000
  83. End Function
  84.  
  85. Function WordLo (LongIn&) As Integer
  86.    If (LongIn And &HFFFF&) > &H7FFF Then
  87.       WordLo = (LongIn And &HFFFF&) - &H10000
  88.    Else
  89.       WordLo = LongIn And &HFFFF&
  90.    End If
  91. End Function
  92.  
  93.